import React, { Component } from 'react';
import { StyleSheet, View, Text, PixelRatio, ActivityIndicator } from 'react-native';
import { GLOBAL } from '../../../../config/global';
import { orderStyle, commonStyle, commen } from '../_common/style';
import navigationSeevice from '../../../../components/navigation/navigationSeevice';
import moment from 'moment';
import { PageStatusIndex } from '../../../../component/page-status/PageStatusIndex';
const scale = GLOBAL.SCALE;
export class WlCpt extends Component {
	constructor(props) {
		super(props);
		this.state = {
			status: 'loading'
		}
	}


	render () {
		let { itemData, flagData } = this.props.data || {};
		let { orderType, noticeId } = flagData || {};

		return (
			<View>
				{itemData && itemData.length && itemData.map((item, index) => {
					return (
						<View style={ styles.tabLie } key={index}>
							<View style={[orderStyle.listHead, commonStyle.row2]}>
								<Text style={orderStyle.listTitle}>委托号 {item.subjectPlanId}</Text>
								<Text style={orderStyle.listStatus}>{item.planStatusName}</Text>
							</View>
							<View style={commonStyle.row3}>
								<Text style={[orderStyle.listValue]}>{orderType == 'S' ? '销售出库' : '采购入库'}通知单</Text>
								<Text style={[orderStyle.xian, { paddingTop: 5 * scale }]}>|</Text>
								<Text style={[orderStyle.listValue]}>{item.transportTypeName}</Text>
								<Text style={[orderStyle.xian, { paddingTop: 5 * scale }]}>|</Text>
								<Text style={[orderStyle.listValue]}>{item.createTime && moment(item.createTime).format("YYYY/MM/DD")} 创建</Text>
							</View>
							<View style={commonStyle.row}>
								<View style={orderStyle.listRow}>
									<Text style={[orderStyle.listLable]}>委托量(吨)</Text>
									<Text style={[orderStyle.listValue]}>{item.sumPlanQuantity || '-'}</Text>
								</View>
								<View style={orderStyle.listRow}>
									<Text style={[orderStyle.listLable]}>已排量(吨)</Text>
									<Text style={[orderStyle.listValue]}>{item.sumDispatchQuantity || '-'}</Text>
								</View>
								<View style={orderStyle.listRow}>
									<Text style={[orderStyle.listLable]}>已运量(吨)</Text>
									<Text style={[orderStyle.listValue]}>{item.sumSheetQuantity || '-'}</Text>
								</View>
							</View>
							<View style={commonStyle.row}>
								<View style={{ flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'flex-end', flex: 1 }}>
									<Text style={[orderStyle.listLoad, { marginTop: 5 * scale }]} onPress={() => { navigationSeevice.navigate('WlmxDetailsPage', { subjectPlanId: item.subjectPlanId, orderType, noticeId }) }}>[物流明细]</Text>
								</View>
							</View>
						</View>
					)
				})}
			</View>

		)
	}
}

const styles = StyleSheet.create({
	tabLie: {
		paddingBottom: 15 * scale,
		marginTop: 15 * scale,
		borderBottomWidth: 1 / PixelRatio.get(),
		borderStyle: 'solid',
		borderBottomColor: '#E3E7F0',
	},
	// tabLie: {
	// 	paddingBottom: 15 * scale,
	// 	marginBottom: 15 * scale,
	// 	borderBottomWidth: 1 / PixelRatio.get(),
	// 	borderStyle: 'solid',
	// 	borderBottomColor: '#E3E7F0',
	// },
})